package org.vaadin.golfscoretracker.data;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderColumn;

import org.vaadin.appfoundation.persistence.data.AbstractPojo;

@Entity
public class Round extends AbstractPojo {

    private static final long serialVersionUID = 5703701060627431442L;

    @ManyToOne
    private Player player;

    @OneToMany(mappedBy = "round")
    @OrderColumn(name = "hole")
    private List<HoleResult> results;

    @ManyToOne(cascade = CascadeType.ALL)
    private RoundSet roundSet;

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }

    public List<HoleResult> getResults() {
        return results;
    }

    public void setResults(List<HoleResult> results) {
        this.results = results;
    }

    public void setRoundSet(RoundSet roundSet) {
        this.roundSet = roundSet;
    }

    public RoundSet getRoundSet() {
        return roundSet;
    }

}
